using System;
using System.Configuration;
using System.Xml;

namespace WoltersKluwer.SPChainGang.Core.Configuration
{
	public class TemplateElement : XmlTextConfigurationElement, ISimpleTextConfigurationElement
	{
        [ConfigurationProperty("name", IsKey = true, IsRequired = true)]
        public string Name
        {
            get
            {
                return (string)this["name"];
            }
        }

		public string Value
		{
			get
			{
				return ValueXml.InnerText;
			}
		}

	    protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey)
	    {
            base.DeserializeElement(reader, serializeCollectionKey);
	        foreach (XmlAttribute attribute in ValueXml.Attributes)
	        {
                this[attribute.Name] = attribute.Value;
	        }            
	    }
	}
}
